<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <button @click="add">
        添加
    </button>
    <button @click="remove">
        移除
    </button>

    <ul>
        <li v-for="(item,index) in arr">{{ index+1 }}{{ item }}</li>
    </ul>
    <h2 v-for="item in veg" v-bind:title="item.name">

        {{ item.name }}</h2>

</div>

<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script>
    var app=new Vue({
        el:"#app",
        data:{
            arr:["北京","上海","广州"],
            veg:[
                {name:"卢"} ,
                {name: "牛"}
            ]
        },
        methods:{
            add:function () {
                this.veg.push({name:"猛"})
            },
            remove:function () {
                this.veg.shift();
            }
        }

    })

</script>
</body>
</html>